<?php
require_once('../phplib/include.inc.php');

class Home_Search extends PageBase{
	public function Ini(){
		$txt = $_REQUEST['txt'];
		$txt = '%'.$txt.'%';
		$this->GetSearchResult($txt);
	}
	public function GetSearchResult($txt){
		$db = getDb();
		$re = $db->fetch("SELECT b.cat_name,a.a_id,a.a_title,a.a_time,a.a_visit FROM article AS a LEFT JOIN category AS b ON a.c_id=b.c_id WHERE a.a_del=0 AND (a.a_title LIKE {0} OR a.a_content LIKE {1}) ORDER BY a.a_id DESC",array($txt,$txt));
		$this->assign("news",$re);
	}
}
$a = new Home_Search("file:".dirname(__FILE__)."/../home/search.tpl.html");
$a->display();
?>